#include <string>
using std::string;

class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        int ransomArr[26] = { 0 };
        for(auto &alph : ransomNote)
        {
            ++ ransomArr[alph - 'a'];
        }
        
        for(auto &alph : magazine)
        {
            -- ransomArr[alph - 'a'];
        }

        for(auto &num : ransomArr)
        {
            if(num > 0) return false;
        }

        return true;
        
    }
};

